<% content_for :sidemenu do %>
  <div class='admin_filters'>
    <%= form_tag admin_fulfillment_orders_path, :method => 'get', :id => "orders_search" do %>
      <p>
        <ul class=' search_boxes'>
          <li><%= label_tag 'Number' %> <%= text_field_tag :number, params[:number] %></li>
          <li><%= label_tag 'Email' %>  <%= text_field_tag :email, params[:email] %></li>
          <li><%= label_tag 'shipped' %>  <%= check_box_tag :shipped, 'true', params[:shipped] == 'true' %></li>
        </ul>
        <div style='text-align:center'>
        <%= submit_tag "Search", :name => nil, :class => 'button red-button' %>
        </div>
      </p>
      <div id="order_hidden">
        <%= hidden_field_tag :direction, params[:direction] %>
        <%= hidden_field_tag :sort, params[:sort] %>
      </div>
    <% end %>
    <div class='clearfix'></div>
  </div>
<% end %>

<h3>Shipping Orders</h3>

<div id="admin_fulfillment_orders_page_wrapper">
  <div id="admin_fulfillment_orders_grid_wrapper" class='column pretty_table'>
      <table class='hover'>
        <thead>
        <tr class='odd'>
          <th class='column1_header'><%= sortable "number" %></th>
          <th><%= sortable "email" %></th>
          <th><%= "Name" %></th>
          <th>Status</th>
          <th><%= 'Shipped' %></th>
        </tr>
        </thead>
        <% @orders.each do |order| %>
          <tr class='<%= cycle("odd", "")%>'>
            <td><%= link_to order.number, edit_admin_fulfillment_order_path(order) %></td>
            <td><%= order.email %></td>
            <td><%= order.name %></td>
            <td><%= order.display_completed_at %></td>
            <td><%= order.shipped.to_s %></td>
          </tr>
        <% end %>
      </table>

    <%= will_paginate @orders %>
  </div>

</div>

